//
//  NewShangChuanBankImageViewController.m
//  wangzhe
//
//  Created by 李 佳伟 on 2018/3/22.
//  Copyright © 2018年 李 佳伟. All rights reserved.
//

#import "NewShangChuanBankImageViewController.h"
#import "JTCSM.h"
#import "MyInfoView.h"
#import "NewBianGenFinishViewController.h"
static CGFloat myinfoHeight = 50;
@interface NewShangChuanBankImageViewController ()
@property (nonatomic,strong) UIImageView *bankImageView;
@end

@implementation NewShangChuanBankImageViewController

- (void)gotBack{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.navigationController.navigationBar.hidden = NO;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.hidden = NO;
    [self.view setBackgroundColor:RGBACOLOR(241, 241, 241, 1)];
    [df isRemoveTarbar:YES];
    leftBarButtonItems_rightBarButtonItems *leftbtn = KCUSTOMNAVIGSTION_ALLOC;
    self.navigationItem.leftBarButtonItem = [leftbtn setBarButtonItemsImageName:@"fanhui.png" frame:KLeftBarButtonItemFrame_image target:self SEL:@selector(gotBack)];
    [self layoutView];
}

- (void)layoutView{
    
    MyInfoView *view2 = [[MyInfoView alloc]initWithFrame:CGRectMake(0, KagainChangeHeight, KCONTROLLERWith, myinfoHeight) imagename:@"绑定银行卡icon.png" title:@"请绑定持卡人本人的银行卡" placeholder:nil isShowLabel:labelType radioBtnIndex:0 GroupId:@""];
    view2.label.frame = CGRectMake(view2.label.LC_x, view2.label.LC_y, KCONTROLLERWith, view2.label.LC_height);
    [self.view addSubview:view2];
    view2.backgroundColor = RGBACOLOR(241, 241, 241, 1);
    CGFloat bankSpace = 50;
    CGFloat bankImageWidth = KCONTROLLERWith-2*bankSpace;
    
    self.bankImageView = [[UIImageView alloc]initWithFrame:CGRectMake(bankSpace, KVIEW_Y(view2), bankImageWidth, bankImageWidth*0.566667)];
    self.bankImageView.image = [UIImage imageNamed:@"银行卡-添加银行卡.png"];
    [self.view addSubview:self.bankImageView];
    
    UIView *bottomeView = [[UIView alloc]init];
    bottomeView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:bottomeView];
    
    UILabel *titleLabel = [UILabel initWithFrame:CGRectMake(20, 0, KCONTROLLERWith-40, myinfoHeight) text:@"变更承诺函" font:14 textAlignment:NSTextAlignmentLeft texcolor:[df colorWithHexString:@"333333" alpha:1] backgroundColor:nil];
    [bottomeView addSubview:titleLabel];
    
    UILabel *contentLabel = [UILabel initWithFrame:CGRectMake(20, KVIEW_Y(titleLabel), titleLabel.LC_width, 20) text:@"本人承若以上内容及所附其他资料真实有效，变更期间结算款按照结算银行卡算清，须知晓！" font:12 textAlignment:NSTextAlignmentLeft texcolor:[df colorWithHexString:@"666666" alpha:1] backgroundColor:nil];
    [bottomeView addSubview:contentLabel];
    CGFloat contentLabelHeight = [df getSpaceLabelLineSpacing:15 withFont:[UIFont systemFontOfSize:12] withLabel:contentLabel];
    contentLabel.frame = CGRectMake(contentLabel.LC_x, contentLabel.LC_y, contentLabel.LC_width, contentLabelHeight);
    
    UILabel *timeLabel = [UILabel initWithFrame:CGRectMake(20, KVIEW_Y(contentLabel)+10, KCONTROLLERWith-40, myinfoHeight) text:@"2018年3月22日" font:14 textAlignment:NSTextAlignmentRight texcolor:[df colorWithHexString:@"999999" alpha:1] backgroundColor:nil];
    [bottomeView addSubview:timeLabel];
    bottomeView.frame = CGRectMake(0, KVIEW_Y(self.bankImageView)+15, KCONTROLLERWith, KVIEW_Y(timeLabel));
    
    
    
    
    NSString *string = @"同意《信用卡还款服务协议》";
    float font = 12;
    CGFloat labelHeight = 30;
    CGRect rect = [df labelHeightWithContent:string height:labelHeight font:font];
    CGFloat btnimagesize = 20;
    CGFloat changesize = 10;
    UIButton * leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
    leftButton.frame = CGRectMake(20, KVIEW_Y(bottomeView)+15, rect.size.width+btnimagesize+changesize, labelHeight);
    [leftButton setImage:[UIImage imageNamed:@"btn_02.png"] forState:UIControlStateNormal];
    [leftButton setImage:[UIImage imageNamed:@"btn_01.png"] forState:UIControlStateSelected];
    
    [leftButton addTarget:self  action:@selector(saveloginInfo:) forControlEvents:UIControlEventTouchUpInside];
    [leftButton setTitle:string forState:UIControlStateNormal];
    [leftButton.titleLabel setFont:[UIFont systemFontOfSize:font]];
    leftButton.imageEdgeInsets = UIEdgeInsetsMake((labelHeight-btnimagesize)/2, 0, (labelHeight-btnimagesize)/2, rect.size.width+changesize);
    leftButton.titleEdgeInsets = UIEdgeInsetsMake(0, -btnimagesize+changesize, 0, 0);
    [leftButton setTitleColor:RGBACOLOR(100, 100, 100, 1) forState:UIControlStateNormal];
    [self.view addSubview:leftButton];
    
    
    UIButton *tijiaobutton = [UIButton buttonWithType:UIButtonTypeCustom];
    tijiaobutton.frame = CGRectMake(25, KVIEW_Y(leftButton)+20, KCONTROLLERWith-40, 50);
    [tijiaobutton addTarget:self action:@selector(tijiao) forControlEvents:UIControlEventTouchUpInside];
    [df layerWithView:tijiaobutton radius:25 width:0 color:nil];
    tijiaobutton.backgroundColor = KZhuTiRGB;
    [tijiaobutton setTitleColor:RGBACOLOR(51, 51, 51, 1) forState:UIControlStateNormal];
    [tijiaobutton setTitle:@"提交申请" forState:UIControlStateNormal];
    [self.view addSubview:tijiaobutton];
    
}
- (void)saveloginInfo:(UIButton *)sender{
    
}
- (void)tijiao{
    [self gotoNewBianGenFinishViewController];
}
- (void)gotoNewBianGenFinishViewController{
    NewBianGenFinishViewController *vc = [[NewBianGenFinishViewController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
